home *** CD-ROM | disk | FTP | other *** search
/ Amiga Collections: Taifun / Taifun 004 (1987-02-15)(Ossowski, Stefan)(DE)(PD).zip / Taifun 004 (1987-02-15)(Ossowski, Stefan)(DE)(PD).adf / MandelVroom / getfile / testing.c < prev   
C/C++ Source or Header  |  1987-03-04  |  2KB  |  98 lines

  1. #include <exec/types.h>
  2. #include <intuition/intuition.h>
  3.  
  4. #include <libraries/dosextens.h>
  5.  
  6. #ifdef MANX
  7. #include <functions.h>
  8. #endif
  9.  
  10. #define I_REV   31
  11. #define G_REV   31
  12.  
  13. #define    EWDTH    640
  14. #define    EHGHT    198
  15.  
  16. #define    NL    NULL
  17.  
  18.  
  19. struct IntuitionBase *IntuitionBase;
  20. struct GfxBase  { int b; } *GfxBase;
  21.  
  22. struct NewScreen TS = {
  23.     0,0,640,200,2,
  24.     1,2,
  25.     HIRES,    WBENCHSCREEN,
  26.     0L, 0L, 0L
  27.     };
  28.  
  29. /* Used to open a Window   */
  30. struct NewWindow EdWindow = {
  31.     0,2,EWDTH,EHGHT-2,        /* LeftEdge,TopEdge,Width,Height */
  32.     1,2,            /* DetailPen,BlockPen    */
  33.     MENUPICK | NEWSIZE | REFRESHWINDOW | ACTIVEWINDOW |
  34.     MOUSEBUTTONS | RAWKEY | MOUSEMOVE,
  35.     WINDOWDRAG | WINDOWSIZING | SIMPLE_REFRESH | ACTIVATE | WINDOWDEPTH,
  36.     NL,NL,"Window",        /* FirstGadget, CheckMark, Title  */
  37.     NL,                /* Screen ( Null)    */
  38.     NL,                /* BitMap        */
  39.     150,45,32767,32767,        /* MinW, MinH, MaxW, MaxH */
  40.     CUSTOMSCREEN };        /* Type            */
  41.  
  42.  
  43. main()
  44. {
  45. struct Window    *eW;
  46. struct Screen    *eS;
  47.  
  48. struct Process    *OurTask;
  49. struct Window    *old_pr_WindowPtr;
  50.  
  51. static char    def_name[50] = "Meps";
  52. static char    def_dir[50] = "df1:";
  53.  
  54.     if ( ! (IntuitionBase = (struct IntuitionBase *)
  55.     OpenLibrary("intuition.library",(long)I_REV)) ||
  56.     ! (GfxBase =(struct GfxBase *)OpenLibrary("graphics.library",(long)G_REV)) )
  57.     {
  58.     printf("Can't open libraries\n");
  59.     exit(20);
  60.     }
  61.  
  62.     if ( ! (eS = (struct Screen *)OpenScreen(&TS)) )
  63.     {
  64.     printf("Can't Open Screen!!!!!\n");
  65.     exit(22);
  66.     }
  67.  
  68.     EdWindow.Screen = eS;
  69.  
  70.     if ( ! (eW =(struct Window *)OpenWindow(&EdWindow)) )
  71.     {
  72.     CloseScreen(eS);
  73.     printf("Can't open window...\n");
  74.     exit(21);
  75.     }
  76.  
  77.     /* CAUTION!!! KNOW ABOUT pr_WindowPtr before you use it!!! */
  78.  
  79.     OurTask = (struct Process *)FindTask(0L);
  80.     old_pr_WindowPtr = OurTask->pr_WindowPtr;
  81.     OurTask->pr_WindowPtr = eW;
  82.  
  83.     get_fname(eW,eS,"Nicht",def_name,def_dir);
  84.  
  85.     printf("File name is :%s\n",def_name);
  86.     printf("Directory is :%s\n",def_dir);
  87.  
  88.     /* ALWAYS RESTORE pr_WindowPtr BEFORE CLOSING THE WINDOW!!! */
  89.     OurTask->pr_WindowPtr = old_pr_WindowPtr;
  90.  
  91.     CloseWindow(eW);
  92.     CloseScreen(eS);
  93.     
  94.     CloseLibrary(GfxBase);
  95.     CloseLibrary(IntuitionBase);
  96. }
  97.  
  98.